<script type="text/jsx">
    import QaText from "./form-el/QaText";
    import QaSelect from "./form-el/QaSelect";
    import QaDate from "./form-el/QaDate";
    import QaTime from "./form-el/QaTime";
    import QaDateTime from "./form-el/QaDateTime";
    import QaCheckBox from "./form-el/QaCheckBox";
    import QaChoosePerson from "./form-el/QaChoosePerson";
    import QaHidden from "./form-el/QaHidden";
    import QaTextArea from "./form-el/QaTextArea";

    export default {
        name: "DynamicFormPartItem",
        props: {
            item: {
                required: true
            }
        },
        components: {
            QaText, QaSelect, QaDate, QaTime, QaDateTime,
            QaCheckBox, QaChoosePerson, QaHidden, QaTextArea
        },
        data() {
            return {}
        },
        methods: {},
        render() {
            let item = this.$props.item;
            //如果是input输入框
            if (item.type == 'text') {
                return (<qa-text item={item}></qa-text>)
            } else if (item.type == 'select') {
                return (<qa-select item={item}></qa-select>)
            } else if (item.type == 'checkbox') {
                return (<qa-check-box item={item}></qa-check-box>)
            } else if (item.type == 'date') {
                return (<qa-date item={item}></qa-date>)
            } else if (item.type == 'time') {
                return (<qa-time item={item}></qa-time>)
            } else if (item.type == 'datetime') {
                return (<qa-date-time item={item}></qa-date-time>)
            } else if (item.type == 'person') {
                return (<qa-choose-person item={item}></qa-choose-person>)
            } else if (item.type == 'hidden') {
                return (<qa-hidden item={item}></qa-hidden>)
            } else if (item.type == 'textarea') {
                return (<qa-text-area item={item}></qa-text-area>)
            } else {
                return (<div>未识别的组件类型：【{item.type}】!</div>)
            }
        }
    }
</script>
